home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 4 / Mac Giga-ROM 4.0 - 1993.toast / FILES / DEV / A-B / 002. TESample.cpt / TESample.r < prev    next >
Text File  |  1988-08-01  |  8KB  |  342 lines

  1. /*------------------------------------------------------------------------------
  2. #
  3. #    Apple Macintosh Developer Technical Support
  4. #
  5. #    MultiFinder-Aware TextEdit Sample Application
  6. #
  7. #    TESample
  8. #
  9. #    TESample.r    -    Rez Source
  10. #
  11. #    Copyright © 1988 Apple Computer, Inc.
  12. #    All rights reserved.
  13. #
  14. #    Versions:    1.0                    8/88
  15. #
  16. #    Components:    TESample.p            August 1, 1988
  17. #                TESample.c            August 1, 1988
  18. #                TESample.a            August 1, 1988
  19. #                TESample.r            August 1, 1988
  20. #                TESample.h            August 1, 1988
  21. #                PTESample.make        August 1, 1988
  22. #                CTESample.make        August 1, 1988
  23. #
  24. #    TESample is an example application that demonstrates how 
  25. #    to initialize the commonly used toolbox managers, operate 
  26. #    successfully under MultiFinder, handle desk accessories and 
  27. #    create, grow, and zoom windows. The fundamental TextEdit 
  28. #    toolbox calls and TextEdit autoscroll are demonstrated. It 
  29. #    also shows how to create and maintain scrollbar controls.
  30. #
  31. #    It does not by any means demonstrate all the techniques you 
  32. #    need for a large application. In particular, Sample does not 
  33. #    cover exception handling, multiple windows/documents, 
  34. #    sophisticated memory management, printing, or undo. All of 
  35. #    these are vital parts of a normal full-sized application.
  36. #
  37. #    This application is an example of the form of a Macintosh 
  38. #    application; it is NOT a template. It is NOT intended to be 
  39. #    used as a foundation for the next world-class, best-selling, 
  40. #    600K application. A stick figure drawing of the human body may 
  41. #    be a good example of the form for a painting, but that does not 
  42. #    mean it should be used as the basis for the next Mona Lisa.
  43. #
  44. #    We recommend that you review this program or Sample before 
  45. #    beginning a new application. Sample is a simple app. which doesn’t 
  46. #    use TextEdit or the Control Manager.
  47. #
  48. ------------------------------------------------------------------------------*/
  49.  
  50. #include "SysTypes.r"
  51. #include "Types.r"
  52.  
  53. #include "TESample.h"
  54.  
  55.  
  56. type 'vers' {
  57.         hex byte;                                                /* Major revision in BCD*/
  58.         hex byte;                                                /* Minor vevision in BCD*/
  59.         hex byte    development = 0x20,                            /* Release stage        */
  60.                     alpha = 0x40,
  61.                     beta = 0x60,
  62.                     final = 0x80, /* or */ release = 0x80;
  63.         hex byte;                                                /* Non-final release #    */
  64.         integer        Country;                                    /* Country code            */
  65.         pstring;                                                /* Short version number    */
  66.         pstring;                                                /* Long version number    */
  67. };
  68.  
  69. resource 'vers' (1) {
  70.     0x01, 0x00, release, 0x00,
  71.     verUS,
  72.     "1.00",
  73.     "1.00, Copyright © 1988 Apple Computer, Inc."
  74. };
  75.  
  76. /* we use an MBAR resource to conveniently load all the menus */
  77.  
  78. resource 'MBAR' (rMenuBar, preload) {
  79.     { mApple, mFile, mEdit };        /* three menus */
  80. };
  81.  
  82.  
  83. resource 'MENU' (mApple, preload) {
  84.     mApple, textMenuProc,
  85.     0b1111111111111111111111111111101,    /* disable dashed line, enable About and DAs */
  86.     enabled, apple,
  87.     {
  88.         "About TESample…",
  89.             noicon, nokey, nomark, plain;
  90.         "-",
  91.             noicon, nokey, nomark, plain
  92.     }
  93. };
  94.  
  95. resource 'MENU' (mFile, preload) {
  96.     mFile, textMenuProc,
  97.     0b0000000000000000000100000000000,    /* enable Quit only, program enables others */
  98.     enabled, "File",
  99.     {
  100.         "New",
  101.             noicon, "N", nomark, plain;
  102.         "Open",
  103.             noicon, "O", nomark, plain;
  104.         "-",
  105.             noicon, nokey, nomark, plain;
  106.         "Close",
  107.             noicon, "W", nomark, plain;
  108.         "Save",
  109.             noicon, "S", nomark, plain;
  110.         "Save As…",
  111.             noicon, nokey, nomark, plain;
  112.         "Revert",
  113.             noicon, nokey, nomark, plain;
  114.         "-",
  115.             noicon, nokey, nomark, plain;
  116.         "Page Setup…",
  117.             noicon, nokey, nomark, plain;
  118.         "Print…",
  119.             noicon, nokey, nomark, plain;
  120.         "-",
  121.             noicon, nokey, nomark, plain;
  122.         "Quit",
  123.             noicon, "Q", nomark, plain
  124.     }
  125. };
  126.  
  127. resource 'MENU' (mEdit, preload) {
  128.     mEdit, textMenuProc,
  129.     0b0000000000000000000000000000000,    /* disable everything, program does the enabling */
  130.     enabled, "Edit",
  131.      {
  132.         "Undo",
  133.             noicon, "Z", nomark, plain;
  134.         "-",
  135.             noicon, nokey, nomark, plain;
  136.         "Cut",
  137.             noicon, "X", nomark, plain;
  138.         "Copy",
  139.             noicon, "C", nomark, plain;
  140.         "Paste",
  141.             noicon, "V", nomark, plain;
  142.         "Clear",
  143.             noicon, nokey, nomark, plain
  144.     }
  145. };
  146.  
  147.  
  148. /* this ALRT and DITL are used as an About screen */
  149.  
  150. resource 'ALRT' (rAboutAlert, purgeable) {
  151.     {40, 20, 160, 296}, rAboutAlert, {
  152.         OK, visible, silent;
  153.         OK, visible, silent;
  154.         OK, visible, silent;
  155.         OK, visible, silent
  156.     };
  157. };
  158.  
  159. resource 'DITL' (rAboutAlert, purgeable) {
  160.     { /* array DITLarray: 5 elements */
  161.         /* [1] */
  162.         {88, 184, 108, 264},
  163.         Button {
  164.             enabled,
  165.             "OK"
  166.         },
  167.         /* [2] */
  168.         {8, 8, 24, 274},
  169.         StaticText {
  170.             disabled,
  171.             "MultiFinder-Aware TextEdit Application"
  172.         },
  173.         /* [3] */
  174.         {32, 8, 48, 237},
  175.         StaticText {
  176.             disabled,
  177.             "Copyright © 1988 Apple Computer"
  178.         },
  179.         /* [4] */
  180.         {56, 8, 72, 136},
  181.         StaticText {
  182.             disabled,
  183.             "Brought to you by:"
  184.         },
  185.         /* [5] */
  186.         {80, 24, 112, 167},
  187.         StaticText {
  188.             disabled,
  189.             "Macintosh Developer  Technical Support"
  190.         }
  191.     }
  192. };
  193.  
  194.  
  195. /* this ALRT and DITL are used to signal an error in editing */
  196.  
  197. resource 'ALRT' (rEditAlert, purgeable) {
  198.     {40, 20, 160, 292}, rEditAlert, {
  199.         OK, visible, silent;
  200.         OK, visible, silent;
  201.         OK, visible, silent;
  202.         OK, visible, silent
  203.     };
  204. };
  205.  
  206. resource 'DITL' (rEditAlert, purgeable) {
  207.     { /* array DITLarray: 3 elements */
  208.         /* [1] */
  209.         {88, 180, 108, 260},
  210.         Button {
  211.             enabled,
  212.             "OK"
  213.         },
  214.         /* [2] */
  215.         {8, 8, 41, 41},
  216.         Icon {
  217.             disabled,
  218.             0
  219.         },
  220.         /* [3] */
  221.         {8, 60, 80, 260},
  222.         StaticText {
  223.             disabled,
  224.             "Sorry, but that Edit command could not b"
  225.             "e completed."
  226.         }
  227.     }
  228. };
  229.  
  230.  
  231. resource 'WIND' (rDocWindow, preload, purgeable) {
  232.     {64, 60, 314, 460},
  233.     zoomDocProc, invisible, goAway, 0x0, "untitled"
  234. };
  235.  
  236.  
  237. resource 'CNTL' (rVScroll, preload) {
  238.     {-1, 385, 236, 401},
  239.     0, visible, 0, 0, scrollBarProc, 0, ""
  240. };
  241.  
  242.  
  243. resource 'CNTL' (rHScroll, preload) {
  244.     {235, -1, 251, 386},
  245.     0, visible, 0, 0, scrollBarProc, 0, ""
  246. };
  247.  
  248.  
  249. /* we put the latest SIZE template here so we can rez with MPW 2.0 */
  250.  
  251. type 'SIZE' {
  252.         boolean        dontSaveScreen,
  253.                     saveScreen;
  254.         boolean     ignoreSuspendResumeEvents,
  255.                     acceptSuspendResumeEvents;
  256.         boolean        enableOptionSwitch,
  257.                     disableOptionSwitch;
  258.         boolean        cannotBackground,
  259.                     canBackground;
  260.         boolean        notMultiFinderAware,
  261.                     multiFinderAware;
  262.         boolean        notOnlyBackground,
  263.                     onlyBackground;
  264.         boolean        dontGetFrontClicks,
  265.                     getFrontClicks;
  266.         unsigned bitstring[9] = 0;
  267.         unsigned longint;    /* preferred memory size in bytes */
  268.         unsigned longint;    /* minimum memory size in bytes */
  269. };    /* ignore the warning caused by re-defining SIZE */
  270.  
  271.  
  272. /* here is the quintessential MultiFinder friendliness device, the SIZE resource */
  273.  
  274. resource 'SIZE' (-1) {
  275.     dontSaveScreen,
  276.     acceptSuspendResumeEvents,
  277.     enableOptionSwitch,
  278.     canBackground,        /* we can background; we don't currently, but our sleep value */
  279.                         /* guarantees we don't hog the Mac while we are in the background */
  280.     multiFinderAware,    /* this says we do our own activate/deactivate; don't fake us out */
  281.     notOnlyBackground,    /* this is definitely note a background-only application! */
  282.     dontGetFrontClicks,    /* change this is if you want "do first click" behavior like the Finder */
  283.     kPrefSize * 1024,
  284.     kMinSize * 1024
  285. };
  286.  
  287.  
  288. type 'MOOT' as 'STR ';
  289.  
  290.  
  291. resource 'MOOT' (0) {
  292.     "MultiFinder-Aware TextEdit Sample Application"
  293. };
  294.  
  295.  
  296. resource 'BNDL' (128) {
  297.     'MOOT',
  298.     0,
  299.     {
  300.         'ICN#',
  301.         {
  302.             0, 128
  303.         },
  304.         'FREF',
  305.         {
  306.             0, 128
  307.         }
  308.     }
  309. };
  310.  
  311.  
  312. resource 'FREF' (128) {
  313.     'APPL',
  314.     0,
  315.     ""
  316. };
  317.  
  318.  
  319. resource 'ICN#' (128) {
  320.     { /* array: 2 elements */
  321.         /* [1] */
  322.         $"04 30 40 00 0A 50 A0 00 0B 91 10 02 08 22 08 03"
  323.         $"12 24 04 05 20 28 02 09 40 10 01 11 80 0C 00 A1"
  324.         $"80 03 FF C2 7E 00 FF 04 01 00 7F 04 03 00 1E 08"
  325.         $"04 E0 00 0C 08 E0 00 0A 10 E0 00 09 08 C0 00 06"
  326.         $"04 87 FE 04 02 88 01 04 01 88 00 84 00 88 00 44"
  327.         $"00 88 00 44 00 88 00 C4 01 10 01 88 02 28 03 10"
  328.         $"01 C4 04 E0 00 02 08 00 73 BF FB EE 4C A2 8A 2A"
  329.         $"40 AA AA EA 52 AA AA 24 5E A2 8A EA 73 BE FB 8E",
  330.         /* [2] */
  331.         $"04 30 40 00 0E 70 E0 00 0F F1 F0 02 0F E3 F8 03"
  332.         $"1F E7 FC 07 3F EF FE 0F 7F FF FF 1F FF FF FF BF"
  333.         $"FF FF FF FE 7F FF FF FC 01 FF FF FC 03 FF FF F8"
  334.         $"07 FF FF FC 0F FF FF FE 1F FF FF FF 0F FF FF FE"
  335.         $"07 FF FF FC 03 FF FF FC 01 FF FF FC 00 FF FF FC"
  336.         $"00 FF FF FC 00 FF FF FC 01 FF FF F8 03 EF FF F0"
  337.         $"01 C7 FC E0 00 03 F8 00 73 BF FB EE 7F BE FB EE"
  338.         $"7F BE FB EE 7F BE FB E4 7F BE FB EE 73 BE FB 8E"
  339.     }
  340. };
  341.  
  342.